﻿//
(function() {

// insert your plugin name here
// eg : var mypluginname = 'image';

var mypluginname = 'waiting';

$(window).data('gui').plugins[mypluginname] =
{

	makeHTML : function(param)
	{
	
		param.options.type = (param.options.type === undefined || param.options.type === null || param.options.type.trim() === '') ? 'circle' : param.options.type.toLowerCase();
		param.options.color = (param.options.color === undefined || param.options.color === null || param.options.color.trim() === '') ? 'blue' : param.options.color.toLowerCase();
		
		if (param.options.type == 'circle')  //http://www.alessioatzeni.com/blog/css3-loading-animation-loop/
		{
			var obj = document.createElement("div"); // don't erase
			var c1 = document.createElement("div"); // don't erase
			c1.setAttribute('data-effect','waiting-fxcircle-1');
			c1.setAttribute('class','waiting_fxcircle_1');
			var c2 = document.createElement("div"); // don't erase
			c2.setAttribute('data-effect','waiting-fxcircle-2');
			c2.setAttribute('class','waiting_fxcircle_2');
			obj.appendChild(c1);
			obj.appendChild(c2);
		} else if (param.options.type == 'circle2')  //http://www.alessioatzeni.com/blog/css3-loading-animation-loop/
		{
			var obj = document.createElement("div"); // don't erase		
			var c1 = document.createElement("div"); // don't erase
			c1.setAttribute('data-effect','waiting-fxcircle-1');
			c1.setAttribute('class','waiting_fxcircle2_1');
			
			var c2 = document.createElement("div"); // don't erase
			c2.setAttribute('data-effect','waiting-fxcircle-2');
			c2.setAttribute('class','waiting_fxcircle2_2');
			
			obj.appendChild(c1);
			obj.appendChild(c2);
		
		} else if (param.options.type == 'bar')  //http://www.alessioatzeni.com/blog/css3-loading-animation-loop/
		{
			var obj = document.createElement("div"); // don't erase
			
			var block1 = document.createElement("div"); // don't erase
			var block2 = document.createElement("div"); // don't erase
			var block3 = document.createElement("div"); // don't erase
			var block4 = document.createElement("div"); // don't erase
			var block5 = document.createElement("div"); // don't erase

			block1.setAttribute('class','waiting_fxbar');
			block2.setAttribute('class','waiting_fxbar');
			block3.setAttribute('class','waiting_fxbar');
			block4.setAttribute('class','waiting_fxbar');
			block5.setAttribute('class','waiting_fxbar');	
			
			block1.setAttribute('data-effect','waiting-fxbar');
			block2.setAttribute('data-effect','waiting-fxbar');
			block3.setAttribute('data-effect','waiting-fxbar');
			block4.setAttribute('data-effect','waiting-fxbar');
			block5.setAttribute('data-effect','waiting-fxbar');

			block1.setAttribute('id','waiting_fxbar_1');
			block2.setAttribute('id','waiting_fxbar_2');
			block3.setAttribute('id','waiting_fxbar_3');
			block4.setAttribute('id','waiting_fxbar_4');
			block5.setAttribute('id','waiting_fxbar_5');	


			
			obj.appendChild(block1);
			obj.appendChild(block2);
			obj.appendChild(block3);
			obj.appendChild(block4);
			obj.appendChild(block5);
		} else if (param.options.type == 'bar2')  //http://armelpingault.com/comment-creer-animation-chargement-opodo-css3/
		{
			var obj = document.createElement("div"); // don't erase
			
			var block1 = document.createElement("div"); // don't erase
			var block2 = document.createElement("div"); // don't erase
			var block3 = document.createElement("div"); // don't erase
			var block4 = document.createElement("div"); // don't erase
			var block5 = document.createElement("div"); // don't erase

			block1.setAttribute('class','waiting_fxopodo');
			block2.setAttribute('class','waiting_fxopodo');
			block3.setAttribute('class','waiting_fxopodo');
			block4.setAttribute('class','waiting_fxopodo');
			block5.setAttribute('class','waiting_fxopodo');	
			
			block1.setAttribute('data-effect','waiting-fxbar');
			block2.setAttribute('data-effect','waiting-fxbar');
			block3.setAttribute('data-effect','waiting-fxbar');
			block4.setAttribute('data-effect','waiting-fxbar');
			block5.setAttribute('data-effect','waiting-fxbar');

			block1.setAttribute('id','waiting_fxopodo_1');
			block2.setAttribute('id','waiting_fxopodo_2');
			block3.setAttribute('id','waiting_fxopodo_3');
			block4.setAttribute('id','waiting_fxopodo_4');
			block5.setAttribute('id','waiting_fxopodo_5');	


			
			obj.appendChild(block1);
			obj.appendChild(block2);
			obj.appendChild(block3);
			obj.appendChild(block4);
			obj.appendChild(block5);
		}
		
		/*
		options['titlebar-fixe'];
		*/
		param.parent.appendChild(obj);
	
		return obj;
		// return null if error
	},

	makeXML : function(xml)
	{
		var element = xml.ownerDocument.createElement(mypluginname); // don't erase
		return element; // don't erase
		// return null if error
	}
}
})();